package com.example.lifecycle.LifeCycleService;

import android.util.Log;

import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleService;


public class MyLifeCycleService extends LifecycleService {


    private MyLifeCycleObserver observer;

    @Override
    public void onCreate() {
        super.onCreate();
        observer = new MyLifeCycleObserver();
        getLifecycle().addObserver(observer);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        getLifecycle().removeObserver(observer);
    }
}
